\documentclass[12pt, a4paper]{article}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english, russian]{babel}
\usepackage{color}
\usepackage{listings}
\definecolor{lightgray}{rgb}{.9,.9,.9}
\definecolor{darkgray}{rgb}{.4,.4,.4}
\definecolor{purple}{rgb}{0.65, 0.12, 0.82}
\lstdefinelanguage{JavaScript}{
  keywords={typeof, new, true, false, catch, function, return, null, catch, switch, var, if, in, while, do, else, case, break},
  keywordstyle=\color{blue}\bfseries,
  ndkeywords={class, export, boolean, throw, implements, import, this},
  ndkeywordstyle=\color{darkgray}\bfseries,
  identifierstyle=\color{black},
  sensitive=false,
  comment=[l]{//},
  morecomment=[s]{/*}{*/},
  commentstyle=\color{purple}\ttfamily,
  stringstyle=\color{red}\ttfamily,
  morestring=[b]',
  morestring=[b]"
}
\lstset{
   language=JavaScript,
   backgroundcolor=\color{lightgray},
   extendedchars=true,
   basicstyle=\footnotesize\ttfamily,
   showstringspaces=false,
   showspaces=false,
   numbers=left,
   numberstyle=\footnotesize,
   numbersep=9pt,
   tabsize=2,
   breaklines=true,
   showtabs=false,
   captionpos=b
}
\author{Andrey Lushnikov}
\title{Online-Latex Sample (english-russian)}
\date{May 5, 2012}
\begin{document}
\maketitle
\tableofcontents
\section{Demo document}
\subsection{Math}

Vector: $\vec{a}: a_x, a_y$ \\
Vector: $\vec{b}: b_x, b_y$ \\
$\vec{a} ^\wedge \vec{b} = \alpha$ \\
$\vec{a} \cdot \vec{b} = |\vec{a}| \cdot |\vec{b}| * \cos \alpha$

$\vec{a} \bot \vec{b} \Leftrightarrow \vec{a} \cdot \vec{b} = 0$

\subsection{Code Listings}
\begin{lstlisting}
for(var i = 0; i < n; i++) {
        console.log(i);
}
\end{lstlisting}

\subsection{Кириллица}
Сервис поддерживает компиляцию кириллических файлов

\end{document}
